package com.ebao.po.talk;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;

import com.ebao.constants.UserType;

/**
 * @desc 用户/医生 说说
 * @author snow
 * @date 2012-7-10
 */
@Entity
@Table(name = "T_Talk")
public class TTalk implements Serializable {

	private static final long serialVersionUID = 5500198502989224392L;
	
	private Long id;
	private UserType userType;		// 用户类型
	private String referId;			// 用户Id
	private String content;			// 说的内容,限定最多255个字
	private String talkDate;		// 日期
	private List<TTalkComment> talkComment = new ArrayList<TTalkComment>();	// 说说的评论回复
	
	@Id
	@GeneratedValue
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@Enumerated(EnumType.ORDINAL)
	public UserType getUserType() {
		return userType;
	}

	public void setUserType(UserType userType) {
		this.userType = userType;
	}

	public String getReferId() {
		return referId;
	}

	public void setReferId(String referId) {
		this.referId = referId;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	@Column(length = 19)
	public String getTalkDate() {
		return talkDate;
	}

	public void setTalkDate(String talkDate) {
		this.talkDate = talkDate;
	}

	@OneToMany(cascade = {CascadeType.MERGE, CascadeType.REMOVE}, mappedBy = "talk", targetEntity = TTalkComment.class)
	@OrderBy(value = "commentDate ASC")
	public List<TTalkComment> getTalkComment() {
		return talkComment;
	}

	public void setTalkComment(List<TTalkComment> talkComment) {
		this.talkComment = talkComment;
	}

}
